package com.wench.design.pattern.prototype.test01;

import java.io.*;

/**
 * @author wench
 */
public class CitationTest {

    public static void main(String[] args) throws Exception {
        Citation citation = new Citation();

        Student fiona = new Student();
        fiona.setName("Fiona");
        citation.setStu(fiona);

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/Users/wench/Develop/wench.txt"));
        oos.writeObject(citation);
        oos.close();

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("/Users/wench/Develop/wench.txt"));
        Citation clone = (Citation) ois.readObject();
        Student stu = clone.getStu();
        stu.setName("Wench");

        System.out.println("fiona与stu是否是同一个对象？" + (fiona == stu));

        citation.show();
        clone.show();

    }
}
